package com.hmdp.config;

import com.hmdp.interceptor.LoginInterceptor;
import com.hmdp.interceptor.RefreshTokenInterceptor;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author �����
 * @create 2022/4/20 18:24
 */
@Configuration
@RequiredArgsConstructor
public class WebMvcConfig implements WebMvcConfigurer {
    private final StringRedisTemplate stringRedisTemplate;

//    @Override
//    public void addInterceptors(InterceptorRegistry registry) {
//        registry.addInterceptor(new LoginInterceptor())
//                .excludePathPatterns(
//                     "/shop/**",
//                     "/voucher/**",
//                     "/shop-type/**",
//                       "/upload/**",
//                       "/blog/hot",
//                       "/user/code",
//                       "/user/login"
//                )
//                //指定拦截器的执行顺序---数字越小,优先级越高
//                .order(2);
//
//      registry.addInterceptor(new RefreshTokenInterceptor(stringRedisTemplate)).order(1);
//    }

}
